//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package templet;

import entity.Templet;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class TempletUtil {
    public TempletUtil() {
    }
    
    public static List<Templet> getTempletList(String basePath) {
        List<Templet> list = null;
        File root = new File(basePath);
        
        try {
            list = showAllFiles(basePath, root);
        } catch (Exception var4) {
            var4.printStackTrace();
        }
        
        return list;
    }
    
    static final List<Templet> showAllFiles(String basePath, File dir) throws Exception {
        List<Templet> list = new ArrayList();
        File[] fs = dir.listFiles();
        
        for(int i = 0; i < fs.length; ++i) {
            Templet templet = new Templet();
            templet.setAllPath(fs[i].getAbsolutePath());
            File file = new File(fs[i].getAbsolutePath());
            templet.setPath(file.getParent().replace(basePath, ""));
            templet.setFileName(file.getName());
            if (fs[i].isDirectory()) {
                try {
                    list.addAll(showAllFiles(basePath, fs[i]));
                } catch (Exception var8) {
                }
            } else {
                list.add(templet);
            }
        }
        
        return list;
    }
}
